package com.starsea.book.ui.newpage.pop

import android.content.Context
import android.widget.ImageView
import android.widget.TextView
import com.lxj.xpopup.core.CenterPopupView
import com.starsea.book.R
import com.starsea.book.ui.newpage.normalview.RadiusLinearLayout
import com.starsea.book.ui.newpage.utils.finialDouble

/**
 * @author Lee
 * @createTime 2023-08-04 16 GMT+8
 * @desc : 补签
 */
class SignHistoryPop(
    var mContext: Context,
    var date: String,
    var coin: String,
    var onResult: ((type: Int) -> Unit)? = null
) :
    CenterPopupView(mContext) {

    lateinit var iv_close: ImageView
    lateinit var tv_title: TextView
    lateinit var tv_content: TextView
    lateinit var tv_coin_sign: TextView
    lateinit var rll_free_sign: RadiusLinearLayout
    lateinit var rll_coin_sign: RadiusLinearLayout


    override fun getImplLayoutId(): Int {
        return R.layout.layout_sign_history
    }

    override fun onCreate() {
        super.onCreate()

        iv_close = findViewById(R.id.iv_close)
        tv_title = findViewById(R.id.tv_title)
        tv_content = findViewById(R.id.tv_content)
        tv_coin_sign = findViewById(R.id.tv_coin_sign)
        rll_free_sign = findViewById(R.id.rll_free_sign)
        rll_coin_sign = findViewById(R.id.rll_coin_sign)

        tv_title.text = "补签${date}"

        tv_content.text =
            "您可以使用${coin.toDouble().finialDouble()}金币补签，也可以通过观看小视频进行免费补签"
        tv_coin_sign.text = "${coin.toDouble().finialDouble()}金币补签"

        rll_free_sign.setOnClickListener {
            onResult!!.invoke(0)
            dismiss()
        }
        rll_coin_sign.setOnClickListener {
            onResult!!.invoke(1)
            dismiss()
        }

    }


}